<template>
    <div style="width: 100%;height: 100%;position: relative">
        <Spin size="large" fix v-if="Loading"></Spin>
        <Form :label-width="180" ref="formValidate" :model="formValidate" id="form"
              :rules="ruleValidate">
            <table>
                <tr>
                    <td colspan="2">
                        <Form-item label="家庭人员信息:">
                            <span style="padding-right: 20px">{{memberInformation}}</span>
                            <font v-if="information.includes('不符合')" color="red"
                                  style="font-size: 16px">{{information}}</font>
                            <font v-else color="green" style="font-size: 16px">{{information}}</font>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td>
                        <Form-item label="家庭月基础收入金额:" prop="ssca0044">
                            <Input v-model="formValidate.ssca0044" placeholder="请输入家庭月基础收入金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="家庭月赡抚养费金额:" prop="ssca0045">
                            <Input v-model="formValidate.ssca0045" placeholder="请输入家庭月赡抚养费金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td style="width: 50%">
                        <Form-item label="家庭月财产收入金额:" prop="ssca0046">
                            <Input v-model="formValidate.ssca0046" placeholder="请输入家庭月财产收入金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="家庭月基础支出金额:" prop="ssca0047">
                            <Input v-model="formValidate.ssca0047" placeholder="请输入家庭月基础支出金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <Form-item label="核减金额:" prop="ssca0113">
                            <Input v-model="formValidate.ssca0113" placeholder="请输入核减金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td style="width: 50%">
                        <Form-item label="家庭月总收入金额(核减并扣除家庭支出):" prop="ssca0049">
                            <Input v-model="formValidate.ssca0049" placeholder="请输入家庭月总收入金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="家庭人口数:" prop="ssca0051">
                            <Input v-model="formValidate.ssca0051" placeholder="请输入家庭人口数" :disabled="disabled"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td style="width: 50%">
                        <Form-item label="保障标准:" prop="ssca0042">
                            <Input v-model="formValidate.ssca0042" placeholder="请输入保障标准" :disabled="disabled"/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="保障人口数:" prop="ssca0052">
                            <Input v-model="formValidate.ssca0052" placeholder="请输入保障人口数" :disabled="disabled"/>
                        </Form-item>
                    </td>
                </tr>
                <tr v-if="formValidate.ssca0002=='100'||formValidate.ssca0002=='200'||formValidate.ssca0002=='102'||formValidate.ssca0002=='202'">
                    <td>
                        <Form-item label="差额保障金额:" prop="ssca0004">
                            <Input v-model="formValidate.ssca0004" placeholder="请输入差额保障金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                    <td style="width: 50%">
                        <Form-item label="分类救助上浮总金额:" prop="ssca0025">
                            <Input v-model="formValidate.ssca0025" placeholder="请输入分类救助上浮总金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td style="width: 50%">
                        <Form-item label="总保障金额:" prop="ssca0026">
                            <Input v-model="formValidate.ssca0026" placeholder="请输入总保障金额" :disabled="disabled"/>
                        </Form-item>
                        <div style="color:red;margin-left: 180px">
                            <span v-if="formValidate.ssca0002=='100'||formValidate.ssca0002=='200'||formValidate.ssca0002=='102'||formValidate.ssca0002=='202'">
                                （总保障金额=差额保障金额+分类救助上浮总金额，不包括高龄补贴总金额）</span>
                            <span v-else>（总保障金额=保障人口数*保障标准，不包括高龄补贴总金额）</span>
                        </div>
                    </td>
                    <td>
                        <Form-item label="高龄补贴总金额:" prop="ssca0065">
                            <Input v-model="formValidate.ssca0065" placeholder="请输入高龄补贴总金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td style="width: 50%">
                        <Form-item label="补差调增调减情况:" prop="ssca0017">
                            <c-dict-select v-model="formValidate.ssca0017" dictCode="changeinsurancereason"
                                           :width="300" :disabled="disabled"/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="补差金额:" prop="ssca0018">
                            <Input v-model="formValidate.ssca0018" placeholder="请输入补差金额" :disabled="disabled"/>
                        </Form-item>
                    </td>
                </tr>

                <tr>
                    <td style="width: 50%">
                        <Form-item label="开户银行名称:" prop="ssca0009">
                            <c-dict-select v-model="formValidate.ssca0009" dictCode="bankcategory" disabled
                                           :width="300"/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="是否代领:" prop="ssca0082">
                            <Select v-model="formValidate.ssca0082" disabled>
                                <Option value="1">是</Option>
                                <Option value="0">否</Option>
                            </Select>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td style="width: 50%">
                        <Form-item label="开户人姓名:" prop="ssca0010">
                            <Input v-model="formValidate.ssca0010" placeholder="请输入开户人姓名" disabled/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="开户人证件号码:" prop="ssca0083">
                            <Input v-model="formValidate.ssca0083" placeholder="请输入开户人证件号码" disabled/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td style="width: 50%">
                        <Form-item label="银行账号:" prop="ssca0011">
                            <Input v-model="formValidate.ssca0011" placeholder="请输入银行账号" disabled/>
                        </Form-item>
                    </td>
                    <td >
                        <Form-item label="原保障类型:" prop="ssca0093">
                            <c-dict-select v-model="formValidate.ssca0093" dictCode="assistancetype" :disabled="true"
                                           :width="300"/>
                        </Form-item>
                    </td>
                </tr>
                <tr v-if="formValidate.ssca0002=='203'">
                    <td>
                        <Form-item label="是否入户调查:" prop="ssca0089">
                            <c-dict-select v-model="formValidate.ssca0089" dictCode="yesorno"
                                           :width="300"/>
                        </Form-item>
                    </td>
                </tr>
                <tr v-if="formValidate.ssca0002!='203'">
                    <td>
                        <Form-item label="是否入户调查、民主评议、审批公示:" prop="ssca0089">
                            <c-dict-select v-model="formValidate.ssca0089" dictCode="yesorno"
                                           :width="300"/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="是否进行经济核查:" prop="ssca0090">
                            <c-dict-select v-model="formValidate.ssca0090" dictCode="yesorno" :disabled="disabled0090"
                                           :width="300"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td style="width: 50%">
                        <Form-item label="变更申请时间:" prop="ssca0033">
                            <DatePicker type="date" v-model="formValidate.ssca0033" placeholder="请选择变更申请时间"
                                        class="time" :editable="false"></DatePicker>
                        </Form-item>
                    </td>
                    <td style="width: 50%">
                        <Form-item label="致贫原因:" prop="ssca0013">
                            <c-dict-select v-model="formValidate.ssca0013" dictCode="poorreason" :width="300"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <Form-item label="变更原因说明:" prop="ssca0034">
                            <c-text-area v-model="formValidate.ssca0034" :max-length="100" :row=3 width="890"
                                         placeholder="请填写变更原因说明"/>
                        </Form-item>
                    </td>
                </tr>

            </table>
        </Form>
        <div id="buttondiv">
            <Button @click="prevStep"> 上一步</Button>
            <Tooltip placement="top">
                <Button type="error" @click="printSs00011" style="margin-left: 10px" :disabled="canSubmit">事前查验结果打印
                </Button>
                <div slot="content">
                    <p>请打印查验结果后，进行提交申请 !</p>
                </div>
            </Tooltip>
            <Button type="primary" @click="nextStep" style="margin-left: 10px" :disabled="submitDisabled">提交申请</Button>
        </div>
        <ss00011-print-modal ref="printModal" @changeSubmit="changeSubmit"/>
    </div>
</template>

<script>
    import {getAction, postAction} from '@/api/request'
    import {CommonMixin} from '@/views/common/js/CommonMixin'
    import {application12} from './js/application12'
    import '@/views/common/css/common.css';
    import Ss00011PrintModal from '../ss11_create_steps/modules/Ss00011PrintModal'

    export default {
        name: "application2",
        mixins: [CommonMixin, application12],
        components: {Ss00011PrintModal},
        data() {
            return {
                formValidate: {
                  ssca0089: null,
                  ssca0090: null,
                  ssca0033: null,
                  ssca0013: null,
                  ssca0034: null
                },
                bpmStatus: "200",
                canSubmit: true,
                isValidate: true,
                validateMsg: "",
                disabled0090: false,
            }
        },
        methods: {

            getTabInfor() {
                var that = this;
                postAction(that.url.tab12Infor, {
                    ss12001Id: this.$parent.familyInfo.ss12001Id,
                    oldSs12001Id: this.$parent.familyInfo.oldSs12001Id
                }).then((res) => {
                    if (res.data.errcode == 0) {
                        that.formValidate = res.data.data.ss12001;

                      if (that.formValidate.ssca0033) {
                        that.formValidate.ssca0033 = this.DateFormat(that.formValidate.ssca0033, 'YYYY-MM-DD');
                      } else {
                        if("212,213,214,215,216,217,218".includes(that.formValidate.ssca0016)){
                          that.formValidate.ssca0033 = this.DateFormat(new Date(), 'YYYY-MM-DD');
                        }else{
                          that.formValidate.ssca0033 = null;
                        }
                      }

                        that.information = res.data.data.information;
                        that.memberInformation = res.data.data.memberInformation;
                        //验证是否新增18周岁以上人员
                        that.validate18Age = res.data.data.validate18Age;
                        that.validateMessage = res.data.data.validateMessage;
                        if (that.validate18Age == true) {
                            //满足条件则 必须进行经济核查、控件不可用
                            that.formValidate.ssca0090 = '1';
                            that.disabled0090 = true;
                        } else {
                            that.disabled0090 = false;
                        }
                        if (that.information.includes('不符合')) {
                            that.canSubmit = true;
                        } else {
                            that.canSubmit = false;
                        }
                        //转换建档立卡时重新是否入户的验证规则
                        if(this.formValidate.ssca0002=='203'){
                            this.ruleValidate.ssca0089=[{required: true, message: '请选择是否入户调查！', trigger: 'change'}]
                        }
                    } else {
                        that.$Message.error(res.data.errmsg);
                    }
                }).finally(() => {
                    that.Loading = false;
                });
            },
        },
        created() {
            this.Loading = true;
            this.getMemberList();
            // this.getFamilyInfor();
            this.getTabInfor();
        }
    }
</script>

<style scoped src="@/views/common/css/application12.css">

</style>
